package com.zhou.errhandler;

import com.zhou.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//异常处理器  邹
@RestControllerAdvice
public class ProjectExceptionAdvice {
    //设定捕获那种异常，并将返回值作为结果抛出
    @ExceptionHandler(Exception.class)
    public Result doException(Exception ex){
        System.out.println("捕获异常");
        //return 出现异常后返回给页面的数据
        return Result.error("出现异常");
    }
}